package com.sxdz.controller.handler

import com.sxdz.api.webService.CalculatorDelegate
import com.sxdz.api.webService.CalculatorService
import com.sxdz.constant.GlobalConstant
import groovy.transform.CompileStatic
import groovy.transform.TypeChecked

import javax.xml.namespace.QName

/**
 * Created by Administrator on 2016/8/12.
 */
@CompileStatic
@TypeChecked
public class CalculatorHandler {
    private static final QName SERVICE_NAME = new QName("http://ws.myeclipseide.com/", "CalculatorService");
    public static  CalculatorDelegate calculatorDelegate=null;

    public static CalculatorDelegate getCalculatorPort(){
        if(calculatorDelegate==null){
            //URL wsdlURL = new URL("http://127.0.0.1:8180/WebChargePro/CalculatorPort?wsdl");
            URL wsdlURL = new URL(GlobalConstant.getString("webServiceUrl"));
            CalculatorService ss = new CalculatorService(wsdlURL, SERVICE_NAME);
            calculatorDelegate=ss.getCalculatorPort();
        }
        return calculatorDelegate

    }
}
